home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 May: Tool Chest / Developer CD Series May 1996 (Tool Chest) (Apple Computer) (1996).iso / Tool Chest / Devices / Apple Color OneScanner / interfaces / ScIntf.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-11-27  |  8.3 KB  |  250 lines  |  [TEXT/MPS ]

  1. /*================================================================================     */
  2. /*     ScIntf.c - C Interface declaration to the Scanner Driver Interface Library         */
  3. /*                                                                                    */
  4. /*    Written by  Tad Browne, PSAP        Created: 20-FEB-88                            */
  5. /*                                                                                    */
  6. /*    Copyright Apple Computer, 1988,1989,1990                                                */
  7. /*_____________________________________________________________________________        */
  8. /*                                                                                    */
  9. /* Modification History:                                                              */
  10. /*                                                                                    */
  11. /*    15-OCT-89 -    Tad Browne                                                            *)
  12. /*    Added new definitions to support Apple 8-bit Scanner:                            */
  13. /*        1) Changed Reserved field of ScCompRec to startResolution and                 */
  14. /*            endResolution to support resolutions in 1 dpi increments                */
  15. /*        2) Changed downLoadFlags in scAdvFeaturesRec to downLoadStart,                */
  16. /*            downLoadEnd, and downLoadFlags to support download patterns                */
  17. /*            other than square, and sizes up to 127 X 127;                            */
  18. /*    02-APR-90 -    Tad Browne                                                            *)
  19. /*        Added new advanced feature: ScSetFastMode (Fast Scan Mode)                    */
  20. /*    03-APR-90 -    Tad Browne                                                            *)
  21. /*        Added new advanced feature: ScVendorUnique (Carriage Position)                */
  22. /*    14-OCT-90 -    Tad Browne                                                            *)
  23. /*        Added ScSetLed, ScResetButton, ScGetButton, ScSetNoCal calls                */
  24. /*    12-NOV-90 -    Tad Browne                                                            *)
  25. /*        Changed ScSetFastMode to ScSetSpeed, added new constants for ScSetSpeed        */
  26. /*        Added constants for Vendor Unique Parameter Types                            */
  27. /*    VERSION 2.0a11 (for driver version 2.0a11-12)                                    */
  28. /*    24-APR-1991 - Bill Houston                                                        */
  29. /*        fixed advanced constants, added version reference to driver                    */
  30. /*    VERSION 2.0a13 (for driver version 2.0a13)                                        */
  31. /*    9-MAY-1991 - Bill Houston                                                        */
  32. /*        changed a char to Boolean in ScGetButton                                    */
  33. /*    9-Dec-91 - Steve Bischoff                                                        */
  34. /*         Added scFullColor,scBiLevelColor                                            */
  35. /*                                                                                    */
  36. /*==============================================================================    */
  37.  
  38.  
  39. /* Standard Constants */
  40.  
  41. #define        scLineArt     0        /* Line Art Composition */
  42. #define        scHalfTone    1        /* HalfTone Composition */
  43. #define        scGrayScale    2        /* Gray Scale Composition */
  44. #define        scBiLevelColor 3    /* BiLevel RGB Color Composition */
  45. #define        scFullColor 4        /* Full Color Composition */
  46.  
  47.  
  48. /* Standard Data Types */
  49.  
  50. typedef struct {
  51.                 unsigned char     brightnessRange;    /* NEW 2.0 */
  52.                 unsigned char     contrastRange;        /* NEW 2.0 */
  53.                 unsigned char     reserved;            /* NEW 2.0 */
  54.                 unsigned char     resFlags;            /* NEW 2.0 */
  55.                 short    resElements;
  56.                 short    halfToneElements;
  57.                 short    brightnessMax;
  58.                 short    contrastMax;
  59.                 long    bitsPerPixel;
  60.                 short    minReadSize;
  61.             } ScCompRec;
  62.  
  63. typedef struct {
  64.                 ResType scannerType;
  65.                 short    version;
  66.                 short    scanWidthNum;
  67.                 short    scanWidthDen;
  68.                 short    scanLengthNum;
  69.                 short    scanLengthDen;
  70.                 ScCompRec composition[scFullColor+1];
  71.             } ScStdFeaturesRec;
  72.  
  73. typedef ScStdFeaturesRec *ScStdFeaturesPtr ;
  74.  
  75. typedef short ScResArray[1];
  76. typedef ScResArray *ScResPtr;
  77.  
  78. typedef unsigned char String31[32];
  79. typedef String31 ScHalfToneArray[1];
  80. typedef ScHalfToneArray *ScHalfTonePtr;
  81.  
  82.  
  83. typedef struct {
  84.                 long    reserved;
  85.                 short    xDpi;
  86.                 short    yDpi;
  87.                 Rect    scanRect;
  88.                 short    brightness;
  89.                 short    contrast;
  90.                 char    composition;
  91.                 char    bitsPerPixel;
  92.                 short    halfTone;
  93.             } ScAreaRec;
  94.  
  95. typedef struct {
  96.                 long        reserved;
  97.                 short        numAreas;
  98.                 ScAreaRec     scanAreas[1];
  99.             } ScScanAreaRec;
  100. typedef    ScScanAreaRec *ScScanAreaPtr;
  101.  
  102.  
  103. /* Standard Routines */
  104.  
  105.     extern pascal short ScOpen(short *refNum);
  106.     extern pascal short ScClose(short refNum);
  107.     extern pascal short ScGetStdFeatures(short refNum,
  108.                                 ScStdFeaturesPtr stdFeaturesPtr,
  109.                                 short length);
  110.     extern pascal short ScGetRes(short refNum, short compType,
  111.                                 ScResPtr resPtr);
  112.     extern pascal short ScGetHalfTones(short refNum, short compType, 
  113.                                 ScHalfTonePtr halfTonePtr);
  114.     extern pascal short ScSetScanArea(short refNum, 
  115.                                 ScScanAreaPtr scanAreaPtr);
  116.     extern pascal short ScDoScan(short refNum, char *buffer, 
  117.                                 long *count, short unused, 
  118.                                 short byteWidth, short rowBytes);
  119.     extern pascal short ScAbortScan(short refNum);
  120.  
  121.  
  122. /* Advanced Constants */
  123.  
  124. #define        scLightDetail     0    /* GrayMap 0 */
  125. #define        scNormalDetail    1    /* GrayMap 1 */
  126. #define        scDarkDetail     2    /* GrayMap 2 */
  127.  
  128. #define        scSpeedNormal    0    /* NORMAL Speed, slow with handshaking */
  129. #define        scSpeedHigh        1    /* HIGH Speed, fast with handshaking */
  130. #define        scSpeedFast        2    /* FAST Speed, fast without handshaking */
  131.  
  132. /* Apple (Vendor) Unique Param Type Constants */
  133.  
  134. #define        scUniqueUnpark    0    /* Unpark the the carriage */
  135. #define        scUniquePark    1    /* Park the the carriage */
  136. #define        scUniqueAbsPos    2    /* Abosolute carriage positioning */
  137. #define        scUniqueRelPos    3    /* Relative carriage positioning */
  138. #define        scUniqueSetID    4    /* Set Scanner Driver SCSI ID */
  139. #define        scUniqueSetCRAM    5    /* Set CRAM Data (always 2550 bytes) */
  140. #define        scUniqueGetCRAM    6    /* Get CRAM Data (always 2550 bytes) */
  141.  
  142.  
  143. /* Advanced Data Types */
  144.  
  145.  
  146. typedef struct {
  147.                 long    reserved;
  148.                 short    version;
  149.                 short    secondaryMax;
  150.                 long    downLoadFlags;
  151.                 long    restrictFlags;
  152.                 long    controlFlags;
  153.             } ScAdvFeaturesRec;
  154. typedef    ScAdvFeaturesRec *ScAdvFeaturesPtr;
  155.  
  156. typedef struct {
  157.                 char xDimension;
  158.                 char yDimension;
  159.                 char patData[64];
  160.             } ScPatRec;
  161. typedef ScPatRec *ScPatPtr;
  162.  
  163. typedef struct {
  164.                 char RedGamma[256];
  165.                 char GreenGamma[256];
  166.                 char BlueGamma[256];
  167.             }ScGammaTableRec;
  168. typedef ScGammaTableRec  *ScGammaTablePtr;
  169.  
  170. typedef struct{
  171.                 short matrix[9];
  172.                 }ScMatrix;
  173.                 
  174. typedef ScMatrix *ScMatrixPtr;
  175.  
  176. /* Advanced Feature Flags */
  177.  
  178. /* Download flags */
  179. #define sc2x2Matrix     0x00000001
  180. #define sc3x3Matrix     0x00000002
  181. #define sc4x4Matrix     0x00000004
  182. #define sc5x5Matrix     0x00000008
  183. #define sc6x6Matrix     0x00000010
  184. #define sc7x7Matrix     0x00000020
  185. #define sc8x8Matrix     0x00000040
  186.  
  187. /* Restrict flags */
  188. #define scDiffXandYDPI    0x00000001
  189. #define scSecondArea    0x00000002
  190. #define scDiffXandYHT    0x00000004 
  191.  
  192. /* Control flags */
  193. #define scSetGroup3     0x00000001
  194. #define scSetGamma         0x00000002
  195. #define scSetThreshold     0x00000004
  196. #define scSetLampOn        0x00000008
  197. #define scSetNoHome        0x00000010
  198. #define scSetWait        0x00000020
  199. #define scSetSpeed        0x00000040
  200. #define scSetLed        0x00000080
  201. #define scGetButton        0x00000100
  202. #define scSetNoCal        0x00000200
  203. #define scLoadGamma        0x00000400
  204. #define scMatrixMul        0x00000800
  205. #define scInvert        0x00001000
  206. #define scSetAtoD        0x00002000
  207. #define scSensorSelect    0x00004000
  208.  
  209. #define scAllSensors    0x00
  210. #define scRedSensor        0x01
  211. #define scGreenSensor    0x02
  212. #define scBlueSensor    0x03
  213.  
  214. /* Advanced Routines  */
  215.  
  216.     extern pascal short ScGetAdvFeatures(short refNum,
  217.                      ScAdvFeaturesPtr advFeaturesPtr,
  218.                      short length);
  219.     extern pascal short ScSetHTPattern(short refNum, ScPatPtr patPtr);
  220.     extern pascal short ScSetGroup3(short refNum, char compressOn);
  221.     extern pascal short ScSetNoHome(short refNum, char noHome);
  222.     extern pascal short ScSetLamp(short refNum, char lampOn);
  223.     extern pascal short ScSetGrayMap(short refNum, short grayMap);
  224.     extern pascal short ScSetThreshold(short refNum, short thesholdLevel);
  225.     extern pascal short ScSetWaitButton(short refNum, char waitButton);
  226.     extern pascal short ScSetSpeed(short refNum, short speed);
  227.     extern pascal short ScSetLed(short refNum, char ledOn);
  228.     extern pascal short ScResetButton(short refNum, char setTrue);
  229.     extern pascal short ScGetButton(short refNum, Boolean *button);
  230.     extern pascal short ScSetNoCal(short refNum, char noCalMode);
  231.     extern pascal short ScVendorUnique(short refNum, short paramType, char *paramPtr);
  232.     extern pascal short ScInvertPixels(short refNum, Boolean invert);
  233.     extern pascal short ScSensorSelect(short refNum, short sensor);
  234.     extern pascal short ScSetScannerAtoD(short refNum, char Vrt,char Vrb);
  235.     extern pascal short ScLoadGamma(short refNum, ScGammaTablePtr gammaPtr);
  236.     extern pascal short ScLoadMatrix(short refNum, ScMatrixPtr matrixPtr);
  237.  
  238.  
  239. /* Error Codes for Scanner */
  240.  
  241.  
  242. #define    scNotFoundErr    -17064        /* Scanner Not Found */
  243. #define    scComErr        -17065        /* Communication Error */
  244. #define    scResetErr        -17066        /* Scanner Reset */
  245. #define    scParamErr        -17067        /* Parameter or Command Error */
  246. #define    scScannerErr    -17068        /* Internal Scanner Malfunction */
  247. #define    scLampErr        -17069        /* Lamp malfunction */
  248. #define    scEOS            -17070        /* End Of Scan */
  249. #define scDimLampErr    -17071        /* Lamp Getting Dim */
  250. #define scBusy            -17072        /* Scanner Already scanning */